package com.gxs.tga.poc.domain;

import java.io.Serializable;

import javax.persistence.*;

import org.codehaus.jackson.annotate.JsonIgnore;

import com.gxs.tga.poc.domain.dto.TgaSolutionDto;

import java.util.List;


/**
 * The persistent class for the TGA_SOLUTION database table.
 * 
 */
@Entity
@Table(name="TGA_SOLUTION")
@NamedQuery(name="TgaSolution.findAll", query="SELECT t FROM TgaSolution t")
public class TgaSolution implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name="SOLUTION_ID", unique=true, nullable=false, length=100)
	private String solutionId;

	@Column(length=500)
	private String description;

	//bi-directional many-to-one association to TgaCompany
	@ManyToOne(fetch=FetchType.EAGER)
	@JoinColumn(name="COMP_ID", nullable=false)
	private TgaCompany tgaCompany;

	//bi-directional many-to-one association to TgaSolutionTP
	@OneToMany(mappedBy="tgaSolution")
	private List<TgaSolutionTP> tgaSolutionTps;

	//bi-directional many-to-one association to TgaSolutionTR
	@OneToMany(mappedBy="tgaSolution")
	private List<TgaSolutionTR> tgaSolutionTrs;

	//bi-directional many-to-one association to TgaWorksheet
	@OneToMany(mappedBy="tgaSolution")
	private List<TgaWorksheet> tgaWorksheets;

	public TgaSolution() {
	}
	
	public TgaSolution(TgaSolutionDto dto, TgaCompany company)
	{
		this.description = dto.getDescription();
		this.solutionId = dto.getSolutionId();
		this.tgaCompany = company;

	}

	public String getSolutionId() {
		return this.solutionId;
	}

	public void setSolutionId(String solutionId) {
		this.solutionId = solutionId;
	}

	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@JsonIgnore
	public TgaCompany getTgaCompany() {
		return this.tgaCompany;
	}

	@JsonIgnore
	public void setTgaCompany(TgaCompany tgaCompany) {
		this.tgaCompany = tgaCompany;
	}

	@JsonIgnore
	public List<TgaSolutionTP> getTgaSolutionTps() {
		return this.tgaSolutionTps;
	}

	@JsonIgnore
	public void setTgaSolutionTps(List<TgaSolutionTP> tgaSolutionTps) {
		this.tgaSolutionTps = tgaSolutionTps;
	}

	public TgaSolutionTP addTgaSolutionTp(TgaSolutionTP tgaSolutionTp) {
		getTgaSolutionTps().add(tgaSolutionTp);
		tgaSolutionTp.setTgaSolution(this);

		return tgaSolutionTp;
	}

	public TgaSolutionTP removeTgaSolutionTp(TgaSolutionTP tgaSolutionTp) {
		getTgaSolutionTps().remove(tgaSolutionTp);
		tgaSolutionTp.setTgaSolution(null);

		return tgaSolutionTp;
	}

	@JsonIgnore
	public List<TgaSolutionTR> getTgaSolutionTrs() {
		return this.tgaSolutionTrs;
	}

	
	@JsonIgnore
	public void setTgaSolutionTrs(List<TgaSolutionTR> tgaSolutionTrs) {
		this.tgaSolutionTrs = tgaSolutionTrs;
	}

	public TgaSolutionTR addTgaSolutionTr(TgaSolutionTR tgaSolutionTr) {
		getTgaSolutionTrs().add(tgaSolutionTr);
		tgaSolutionTr.setTgaSolution(this);

		return tgaSolutionTr;
	}

	public TgaSolutionTR removeTgaSolutionTr(TgaSolutionTR tgaSolutionTr) {
		getTgaSolutionTrs().remove(tgaSolutionTr);
		tgaSolutionTr.setTgaSolution(null);

		return tgaSolutionTr;
	}
	
	@JsonIgnore
	public List<TgaWorksheet> getTgaWorksheets() {
		return this.tgaWorksheets;
	}

	@JsonIgnore
	public void setTgaWorksheets(List<TgaWorksheet> tgaWorksheets) {
		this.tgaWorksheets = tgaWorksheets;
	}

	@JsonIgnore
	public TgaWorksheet addTgaWorksheet(TgaWorksheet tgaWorksheet) {
		getTgaWorksheets().add(tgaWorksheet);
		tgaWorksheet.setTgaSolution(this);

		return tgaWorksheet;
	}

	@JsonIgnore
	public TgaWorksheet removeTgaWorksheet(TgaWorksheet tgaWorksheet) {
		getTgaWorksheets().remove(tgaWorksheet);
		tgaWorksheet.setTgaSolution(null);

		return tgaWorksheet;
	}


}